<?php

class Application_Form_Usuario extends Zend_Form
{

    public function init()
    {
        $this->clearDecorators();
        $decorators = array(
            array('ViewHelper'),
            array('Errors'),
            array('Label',array(
                'class' => 'leftalign'
            )),
            array('HtmlTag',array('tag' => 'li'))
        );

        $this->setName('usuario');

        $id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');

        $nome = new Zend_Form_Element_Text('nome');
        $nome->setLabel('Nome')
            ->setAttrib('size', 50)
            ->setRequired(true)
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('NotEmpty');
        $nome->setDecorators($decorators);

        $apelido = new Zend_Form_Element_Text('apelido');
        $apelido->setLabel('apelido')
            ->setAttrib('size', 50)
            ->setRequired(true)
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('NotEmpty');
        $apelido->setDecorators($decorators);

        $senha = new Zend_Form_Element_Password('senha');
        $senha->setLabel('Senha')
            ->addFilter('StripTags')
            ->addFilter('StringTrim');
        $senha->setDecorators($decorators);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');
        $submit->setDecorators(array(
            array('ViewHelper'),
            array('HtmlTag',
                array(
                'tag' => 'li',
                'class' => 'submit'))
        ));

        $this->setDecorators(array(
           'FormElements',
            array('HtmlTag',array('tag'=>'ul')),
            array(
                array(
                    'DivTag'=>'HtmlTag'
                ),
                array(
                    'tag'=>'div',
                    'class'=>'FormDiv'
                )
            ),
            'Form'
        ));

        $this->addElements(array($id, $nome, $apelido, $senha, $submit));
    }


}

